<%@ page language="java" pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="ww" uri="webwork" %>
<ww:bean name="'com.css.apps.base.dict.service.DictMan'" id="dictID" />
<ww:bean name="'com.css.apps.base.sysjob.service.SysJobService'" id="sysPostService" />

<form style="min-height:540px;" class="form-horizontal table-form"  name="dirorgpostsysroles_form" id="dirorgpostsysroles_form" action="dirOrgJobSysRoles.action"  onsubmit="return $action.query(this)">
    <input type="hidden" name="parentId" id="parentId" value="<ww:property value='parentId'/>">
	<input type="hidden" id="orgId" name="orgId" value="<ww:property value='orgId'/>">
	<input type="hidden" id="jobId" name="jobId" value="<ww:property value='jobId'/>">
	
	<div class="table-header">
		<div class="table-btn">
			<div class="btn-group">
				<ww:link funcode="acl_org/addOrg" css="btn" caption="设置" title="设置系统角色" rel="getOrgPostSysRoles" onclick="getSysRolesByOrgJob()"></ww:link>
			</div>
			<div class="btn-group">
				 <ww:link funcode="acl_org/delOrg" css="btn" caption="删除"  onclick="$action.execBatch(this,{url:'delOrgJobSysRoles.action?orgId=%{orgId}&jobId=%{jobId}',title:'将删除系统权限，确认删除?'});"  href="javascript:;"></ww:link>
			</div>
		</div>
	</div>
	<table class="table table-bordered">
		<thead>
			<tr>
				<th width="25px"><input group="ids" class="cleck-all" type="checkbox"/></th>
				<th width="150px">系统名称</th>
				<th >所属角色权限</th>
			</tr>
		</thead>
		<tbody id="selectRole">
			<ww:iterator id="sysData" value="#selectSys">
				<tr>
					<td class="text-center"><input type="checkbox"  name="ids" id="ids" value="<ww:property value="key" />"/></td>
					<td class="text-center"><ww:property value="#sysPostService.getSystemName(key)"/></td>
					<td>
						<ul id="ul_<ww:property value='key'/>">
							<ww:iterator id="itemList" value="value">
								<li><ww:property value='roleName' /></li>
							</ww:iterator>
						</ul>
					</td>
				</tr>
			</ww:iterator>
		</tbody>
	</table>
</form>
<script type="text/javascript">
function getSysRolesByOrgJob(){
	var $tab = $.cssTab.focus();
	var $form=$('#div_org', $tab).find("#dirorgpostsysroles_form");
	var orgId = $("#orgId",$form).val();
	var jobId = $("#jobId",$form).val();
	if (isnull(orgId) || isnull(jobId)) {
		$.dialog.alert('请先选择组织机构和相关职务！');
		return false;
	}
	var title = "设置系统角色";
	var a={
        	id:'getOrgPostSysRoles',
            title:title,
            lock:true,
            resize: false,
            max:false,
            min:false,
            padding: 0
        }
	var api = $.dialog(a);
    $.ajax({
        url:'getOrgJobSysRoles.action?orgId='+orgId,
        data: 'jobId='+jobId,
	  	type: 'POST',
      	success:function(content){
      		try{
	    		  api.content(content);
	    	  }catch(e){}
	    	  finally{
	    		  api.position('50%','38.2%');
	    	  }
        },
        cache:false
    });
}
</script>